<!DOCTYPE html>
<html lang="en">
<head>
	<title>招商加盟</title>
	<meta name="keywords" content="机库网供应商平台" />
	<meta name="description" content="机库网供应商平台" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />

	<!-- basic styles -->

	<link href="__SKIN__/assets/css/bootstrap.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__SKIN__/assets/css/font-awesome.min.css" />

	<!--[if IE 7]>
	<link rel="stylesheet" href="__SKIN__/assets/css/font-awesome-ie7.min.css" />
	<![endif]-->

	<!-- page specific plugin styles -->

	<link rel="stylesheet" href="__SKIN__/assets/css/select2.css" />

	<!-- ace styles -->

	<link rel="stylesheet" href="__SKIN__/assets/css/ace.min.css" />
	<link rel="stylesheet" href="__SKIN__/assets/css/ace-rtl.min.css" />
	<link rel="stylesheet" href="__SKIN__/assets/css/ace-skins.min.css" />

	<!--[if lte IE 8]>
	<link rel="stylesheet" href="__SKIN__/assets/css/ace-ie.min.css" />
	<![endif]-->
	<link href="__APP_SKIN__js/uploadify/uploadify.css?2" rel="stylesheet" type="text/css" />
	<!-- inline styles related to this page -->

	<!-- ace settings handler -->

	<script src="__SKIN__/assets/js/ace-extra.min.js"></script>

	<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

	<!--[if lt IE 9]>
	<script src="__SKIN__/assets/js/html5shiv.js"></script>
	<script src="__SKIN__/assets/js/respond.min.js"></script>
	<![endif]-->
</head>
<style>
	#b_pic2-button{
		background:#428bca;
		color: #fff;
	}
</style>

<body>
<div class="navbar navbar-default" id="navbar">
	<script type="text/javascript">
		try{ace.settings.check('navbar' , 'fixed')}catch(e){}
	</script>

	<div class="navbar-container" id="navbar-container">
		<div class="navbar-header pull-left">
			<a href="#" class="navbar-brand">
				<small>
					<i class="icon-leaf"></i>
					欢迎入住机库网供应商平台
				</small>
			</a><!-- /.brand -->
		</div><!-- /.navbar-header -->
	</div><!-- /.container -->
</div>

<div class="main-container" id="main-container">
	<script type="text/javascript">
		try{ace.settings.check('main-container' , 'fixed')}catch(e){}
	</script>

	<div class="main-container-inner">
		<div class="main-content">
			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
						<!-- PAGE CONTENT BEGINS -->
						<div class="row-fluid">
							<div class="span12">
								<div class="widget-box">

									<div class="widget-body">
										<div class="widget-main">
											<div id="fuelux-wizard" class="row-fluid" data-target="#step-container">
												<ul class="wizard-steps">
													<li data-target="#step1" class="active">
														<span class="step">1</span>
														<span class="title">基本资料</span>
													</li>

													<li data-target="#step2">
														<span class="step">2</span>
														<span class="title">证照</span>
													</li>

													<li data-target="#step3">
														<span class="step">3</span>
														<span class="title">账号信息</span>
													</li>

													<li data-target="#step4">
														<span class="step">4</span>
														<span class="title">其他信息</span>
													</li>
												</ul>
											</div>

											<hr />
											<div class="step-content row-fluid position-relative" id="step-container">
												<div class="step-pane active" id="step1">
													<div class="form-horizontal" id="sample-form">
														<div class="form-group">
															<label for="s_name" class="col-xs-12 col-sm-3 control-label no-padding-right">商家名称</label>

															<div class="col-xs-9 col-sm-3">
																<div class="clearfix">
																	<input type="text" name="s_name" id="s_name" class="col-xs-12 col-sm-6" />
																</div>
															</div>
														</div>

														<div class="form-group">
															<label for="s_addr" class="col-xs-12 col-sm-3 control-label no-padding-right">商家地址</label>

															<div class="col-xs-9 col-sm-3">
																<div class="clearfix">
																	<input type="text" name="s_addr" id="s_addr" class="col-xs-12 col-sm-6" />
																</div>
															</div>
														</div>

														<div class="form-group">
															<label for="s_addr" style="line-height: 50px;" class="col-xs-12 col-sm-3 control-label no-padding-right">商家LOGO</label>

															<div class="col-xs-9 col-sm-3">
																<div id="s_logo">

																</div>
																<div class="clearfix" >
																	<a href="javascript:void(0)" id="b_pic2" name="file_upload"  multiple="true" >上传LOGO图标</a>
																</div>
																<input type="hidden" id="hidden_logo">
															</div>
														</div>



													</div>

													<div class="form-horizontal " id="validation-form" method="get">

														<div class="space-2"></div>

														<div class="hr hr-dotted"></div>


														<div class="space-2"></div>

														<div class="form-group">
															<label class="control-label col-xs-12 col-sm-3 no-padding-right">联系人:</label>

															<div class="col-xs-12 col-sm-9">
																<input type="tel" class="col-xs-9 col-sm-3" id="contact_name" name="contact_name" />
															</div>
														</div>
														<div class="space-2"></div>

														<div class="form-group">
															<label class="control-label col-xs-12 col-sm-3 no-padding-right" >联系电话:</label>

															<div class="col-xs-12 col-sm-9">
																<div class="input-group">
																			<span class="input-group-addon">
																				<i class="icon-phone"></i>
																			</span>

																	<input type="tel" id="contact_tel" class="col-xs-12 col-sm-2 " name="contact_tel" />
																</div>
															</div>
														</div>

														<div class="space-2"></div>
														<div class="form-group">
															<label class="control-label col-xs-12 col-sm-3 no-padding-right" >商家网址:</label>

															<div class="col-xs-12 col-sm-9">
																	<input type="tel" class="col-xs-9 col-sm-3" id="site_url" name="site_url" />
															</div>
														</div>


														<div class="hr hr-dotted"></div>

														<div class="space-2"></div>

														<div class="form-group">
															<div class="col-xs-12 col-sm-4 col-sm-offset-3">
																<label>
																	<input name="agree" id="agree" type="checkbox" class="ace" />
																	<span class="lbl"> 我同意 <a href="#">招商协议</a> </span>
																</label>
															</div>
														</div>
													</div>
												</div>
												<div class="step-pane" id="step2">
													<div class=" row-fluid">
														<div class="form-horizontal" id="sample-form2">
															<div class="form-group">
																<label class="col-xs-12 col-sm-3 control-label no-padding-right">营业执照号</label>

																<div class="col-xs-6 col-sm-3">
																			<input type="text" id="license_no" class="width-50" />
																</div>
																<div class="help-block col-xs-12 col-sm-reset inline"> 请企业或者个体工商户主体营业执照! </div>
															</div>

															<div class="form-group ">
																<label  class="col-xs-12 col-sm-3 control-label no-padding-right">图片附件</label>

																<div class="col-xs-6 col-sm-2">
																	<a id="b_pic1"  name="file_upload"  multiple="true" >上传</a>
																</div>
																<div class="help-block col-xs-12 col-sm-reset inline"> 请上传营业执照，门店照片,主营产品图片等辅助材料。 </div>
															</div>
															<div class="form-group ">
																<label  class="col-sm-3 control-label no-padding-right"></label>

																<div class="col-xs-6 col-sm-9" id="s_attach">

																</div>

															</div>

														</div>

													</div>
												</div>
												<div class="step-pane" id="step3">
													<div class=" row-fluid">
														<div class="form-horizontal" id="sample-form3">
															<div class="form-group">
																<label for="password1" class="col-xs-12 col-sm-3 control-label no-padding-right">登录账号</label>

																<div class="col-xs-6 col-sm-2">
																		<span class="block input-icon input-icon-right">
																			<input type="text" id="login_username" class="width-50" />
																			<i class="icon-info-sign"></i>
																		</span>
																</div>
																<div class="help-block col-xs-12 col-sm-reset inline"> 请输入登录账号! </div>
															</div>
															<div class="form-group">
																<label for="password1" class="col-xs-12 col-sm-3 control-label no-padding-right">登录密码</label>

																<div class="col-xs-6 col-sm-2">
																		<span class="block input-icon input-icon-right">
																			<input type="password" id="password1" class="width-50" />
																			<i class="icon-info-sign"></i>
																		</span>
																</div>
																<div class="help-block col-xs-12 col-sm-reset inline"> 请输入供应商平台平台登录密码! </div>
															</div>

															<div class="form-group">
																<label for="password2" class="col-xs-12 col-sm-3 control-label no-padding-right">确认密码</label>

																<div class="col-xs-6 col-sm-2">
																		<span class="block input-icon input-icon-right">
																			<input type="password" id="password2" class="width-50" />
																			<i class="icon-info-sign"></i>
																		</span>
																</div>
																<div class="help-block col-xs-12 col-sm-reset inline"> 请确认密码! </div>
															</div>

														</div>
													</div>
												</div>
												<div class="step-pane" id="step4">
													<div class=" row-fluid">
														<div class="form-horizontal" id="sample-form4">
															<div class="form-group">
																<label class="control-label col-xs-12 col-sm-3 no-padding-right" >主营业务</label>

																<div class="col-xs-12 col-sm-9">
																	<div class="clearfix">
																		<textarea class="input-xlarge" name="comment" id="scope"></textarea>
																	</div>
																</div>
															</div>
															<div class="form-group">
																<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="remark">备注</label>

																<div class="col-xs-12 col-sm-9">
																	<div class="clearfix">
																		<textarea class="input-xlarge" name="comment" id="remark"></textarea>
																	</div>
																</div>
															</div>
														</div>
													</div>
											</div>
											</div>
											<hr />
											<div class="row-fluid wizard-actions">
												<button class="btn btn-prev">
													<i class="icon-arrow-left"></i>
													上一步
												</button>

												<button class="btn btn-success btn-next" data-last="提交">
													下一步
													<i class="icon-arrow-right icon-on-right"></i>
												</button>
											</div>
										</div><!-- /widget-main -->
									</div><!-- /widget-body -->
								</div>
							</div>
						</div>

						<div id="modal-wizard" class="modal">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header" data-target="#modal-step-contents">
										<ul class="wizard-steps">
											<li data-target="#modal-step1" class="active">
												<span class="step">1</span>
												<span class="title">Validation states</span>
											</li>

											<li data-target="#modal-step2">
												<span class="step">2</span>
												<span class="title">Alerts</span>
											</li>

											<li data-target="#modal-step3">
												<span class="step">3</span>
												<span class="title">Payment Info</span>
											</li>

											<li data-target="#modal-step4">
												<span class="step">4</span>
												<span class="title">Other Info</span>
											</li>
										</ul>
									</div>

									<div class="modal-body step-content" id="modal-step-contents">
										<div class="step-pane active" id="modal-step1">
											<div class="center">
												<h4 class="blue">Step 1</h4>
											</div>
										</div>

										<div class="step-pane" id="modal-step2">
											<div class="center">
												<h4 class="blue">Step 2</h4>
											</div>
										</div>

										<div class="step-pane" id="modal-step3">
											<div class="center">
												<h4 class="blue">Step 3</h4>
											</div>
										</div>

										<div class="step-pane" id="modal-step4">
											<div class="center">
												<h4 class="blue">Step 4</h4>
											</div>
										</div>
									</div>

									<div class="modal-footer wizard-actions">
										<button class="btn btn-sm btn-prev">
											<i class="icon-arrow-left"></i>
											Prev
										</button>

										<button class="btn btn-success btn-sm btn-next" data-last="Finish ">
											Next
											<i class="icon-arrow-right icon-on-right"></i>
										</button>

										<button class="btn btn-danger btn-sm pull-left" data-dismiss="modal">
											<i class="icon-remove"></i>
											Cancel
										</button>
									</div>
								</div>
							</div>
						</div><!-- PAGE CONTENT ENDS -->
					</div><!-- /.col -->
				</div><!-- /.row -->
			</div><!-- /.page-content -->
		</div><!-- /.main-content -->

		<div class="ace-settings-container" id="ace-settings-container">
			<div class="btn btn-app btn-xs btn-warning ace-settings-btn" id="ace-settings-btn">
				<i class="icon-phone bigger-150"></i>
			</div>

			<div class="ace-settings-box" id="ace-settings-box">
				<div>
					<label class="lbl"><a href="#">招商政策</a> </label>
				</div>

				<div>
					<label class="lbl"><a href="#">18096018966</a></label>
				</div>
			</div>
		</div><!-- /#ace-settings-container -->
	</div><!-- /.main-container-inner -->

	<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
		<i class="icon-double-angle-up icon-only bigger-110"></i>
	</a>
</div><!-- /.main-container -->

<!-- basic scripts -->

<!--[if !IE]> -->

<script type="text/javascript">
	window.jQuery || document.write("<script src='__SKIN__/assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
	window.jQuery || document.write("<script src='__SKIN__/assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

<script type="text/javascript">
	if("ontouchend" in document) document.write("<script src='__SKIN__/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>
<script src="__APP_SKIN__js/jquery-2.0.3.min.js"></script>
<script src="__SKIN__/assets/js/bootstrap.min.js"></script>
<script src="__SKIN__/assets/js/typeahead-bs2.min.js"></script>

<!-- page specific plugin scripts -->

<script src="__SKIN__/assets/js/fuelux/fuelux.wizard.min.js"></script>
<script src="__SKIN__/assets/js/jquery.validate.min.js"></script>
<script src="__SKIN__/assets/js/additional-methods.min.js"></script>
<script src="__SKIN__/assets/js/bootbox.min.js"></script>
<script src="__SKIN__/assets/js/jquery.maskedinput.min.js"></script>
<script src="__SKIN__/assets/js/select2.min.js"></script>

<!-- ace scripts -->

<script src="__SKIN__/assets/js/ace-elements.min.js"></script>
<script src="__SKIN__/assets/js/ace.min.js"></script>

<script src="__APP_SKIN__js/uploadify/jquery.uploadify.js?12" type="text/javascript"></script>
<!-- inline scripts related to this page -->

<script type="text/javascript">
	jQuery(function($) {
		upload2($("#b_pic2"));
		upload($("#b_pic1"));
		$("#b_pic2-button .uploadify-button-text").html('上传LOGO');
		$("#s_name").blur(function(){
			var s_name=$.trim($('input[name="s_name"]').val());
			if(s_name==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家名称</span>"
				});
				return false;
			}

		});
		$("#s_addr").blur(function(){
			var address =$.trim($("input[name='s_addr']").val());
			if(address==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家地址</span>"
				});
				return false;
			}
		});
		$("#contact_name").blur(function(){
			var contact_name=$.trim($("#contact_name").val());
			if(contact_name==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入联系人</span>"
				});
				return false;
			}
		});
		$("#contact_tel").blur(function(){
			var contact_tel = $.trim($("#contact_tel").val());
			if(contact_tel==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入联系电话</span>"
				});
				return false;
			}
		});
		$("#site_url").blur(function(){
			var site_url=$('#site_url').val();
			if(site_url==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家网址</span>"
				});
				return false;
			}
		});
		$("#license_no").blur(function(){
			var license_no=$('#license_no').val();
			if(license_no==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入营业执照号</span>"
				});
				return false;
			}
		});
		$("#login_username").blur(function(){
			var login_username=$.trim($('#login_username').val());
			if(login_username==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入登录账号</span>"
				});
				return false;
			}
		});
		$("#password1").blur(function(){
			var password1=$.trim($('#password1').val());
			if(password1==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入登录密码</span>"
				});
				return false;
			}
		});
		$("#password2").blur(function(){
			var password2=$.trim($('#password2').val());
			if(password2==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入确认密码</span>"
				});
				return false;
			}
		});
		$("#scope").blur(function(){
			var scope=$('#scope').val();
			if(scope==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入主营业务</span>"
				});
				return false;
			}
		});
		$("#remark").blur(function(){
			var remark=$('#remark').val();
			if(remark==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入备注</span>"
				});
				return false;
			}
		});
		var $validation = false;
		$('#fuelux-wizard').ace_wizard().on('change' , function(e, info){
			if(info.step == 1 && $validation) {
				if(!$('#validation-form').valid()) return false;
			}
		}).on('finished', function(e) {

			var s_name=$.trim($('input[name="s_name"]').val()),
					address =$.trim($("input[name='s_addr']").val()),
					contact_name=$.trim($("#contact_name").val()),
					contact_tel = $.trim($("#contact_tel").val()),
					site_url=$('#site_url').val(),
					license_no=$('#license_no').val(),
					scope=$('#scope').val(),
					remark=$('#remark').val(),
					password1=$.trim($('#password1').val()),
					login_username=$.trim($('#login_username').val()),
					image=$.trim($('#hidden_logo').val()),
					password2=$.trim($('#password2').val());
			var file_name = $("input[name='upload_files']").map(function(index,elem) {
				return $(elem).val();
			}).get().join(',');

			if(s_name==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家名称</span>"
				});
				return false;
			}
			if(address==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家地址</span>"
				});
				return false;
			}
			if(image==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请上传商家LOGO</span>"
				});
				return false;
			}
			if(contact_name==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入联系人</span>"
				});
				return false;
			}
			if(contact_tel==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入联系电话</span>"
				});
				return false;
			}
			if(site_url==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入商家网址</span>"
				});
				return false;
			}
			if ($('#agree').is(':checked') ) {

			}else{
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请勾选同意协议</span>"
				});
				return false;
			}
			if(license_no==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入营业执照号</span>"
				});
				return false;
			}
			if(file_name==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请上传图片附件</span>"
				});
				return false;
			}
			if(login_username==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入登录账号</span>"
				});
				return false;
			}
			if(password1==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入登录密码</span>"
				});
				return false;
			}
			if(password2==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入确认密码</span>"
				});
				return false;
			}
			if(scope==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入主营业务</span>"
				});
				return false;
			}
			if(remark==''){
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>请输入备注</span>"
				});
				return false;
			}
			if (password1!= password2) {
				bootbox.dialog({
					message: "<span class='btn-sm btn-danger'>登录密码与确认密码不一致！</span>"
				});
				return false;
			}


			var  data={"name":s_name, "address":address, "contact_name":contact_name, "contact_tel":contact_tel, "site_url":site_url,
				"license_no":license_no, "login_username":login_username, "login_password":password1,"scope":scope,"remark":remark,"image":image,
				"file_name":file_name,
			};

			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				url:"{:Controller::createUrl('vis/other/addSuppliers')}",
				data:data,
				success:function(data,textStatus){
					if(data.code==200){
						bootbox.dialog({
							message: data.msg,
							buttons: {
								"success" : {
									"label" : "OK",
									"className" : "btn-sm btn-primary"
								}
							}
						});
					}else{
						bootbox.dialog({
							message: "谢谢! 您的信息保存失败，请重新检查无误后提交!",
							buttons: {
								"success" : {
									"label" : "OK",
									"className" : "btn-sm error btn-info"
								}
							}
						});
					}
				},
				error:function(XMLHttpRequest,textStatus,errorThrown){
					bootbox.dialog({
						message: "<span class='btn-sm btn-danger'>网络错误！</span>"
					});

				}
			});


		}).on('stepclick', function(e){
			//return false;
			// prevent clicking on steps
		});
		$('#modal-wizard .modal-header').ace_wizard();
		$('#modal-wizard .wizard-actions .btn[data-dismiss=modal]').removeAttr('disabled');
	})
	function upload2(obj){
		$(obj).uploadify({
			'height'   : 40,
			'width'   : 140,
			'multi':true,
			'formData'      : {'file_type' : 0},
			'swf'      : '__APP_SKIN__js/uploadify/uploadify.swf',    //指定上传控件的主体文件
			'uploader' : '{:Controller::createUrl("vis/file/index")}',    //指定服务器端上传处理文件
			'fileTypeExts': '*.jpg',  //jpeg;*.gif;*.png
			'fileTypeDesc': 'Image Files',
			'fileSizeLimit' : '4096KB',
			'buttonText':"",
			'queueSizeLimit' : 5,
			//检测FLASH失败调用
			'onFallback':function(){
				alert("您的浏览器未安装FLASH控件，无法上传图片，请安装FLASH控件后再试！");
			},
			//返回一个错误，选择文件的时候触发
			'onSelectError':function(file, errorCode, errorMsg){
				switch(errorCode) {
					case -100:
						alert("上传的文件数量已经超出限制的"+$('a[name=file_upload]').uploadify('settings','queueSizeLimit')+"个文件！");
						break;
					case -110:
						alert("文件 ["+file.name+"] 大小超出系统限制的"+$('a[name=file_upload]').uploadify('settings','fileSizeLimit')+"大小！");
						break;
					case -120:
						alert("文件 ["+file.name+"] 大小异常！");
						break;
					case -130:
						alert("文件 ["+file.name+"] 类型不正确！");
						break;
				}
			},

			'onUploadError':function(file, errorCode, errorMsg, errorString){
				alert(errorString);
			},
			'onUploadSuccess' : function(file, data, response) {
				var service_url = "{:Controller::getConfig('file_server_url')}";
				var jsons       = "/2013/"+data;
				var file_logo=service_url+jsons;
				//$('#' + file.id).parent().find('img').remove();

				$('#' + file.id).parent().attr('filename',data);
				if ($(".no_pic").length > 0) {
					$(".no_pic").remove();
				}
				$("#s_logo img").remove();
				$("#s_logo").append("<img class='preview-upload-pic' style='height:110px;max-width:160px; margin:5px;' src='"+service_url+jsons+"'/>&nbsp;" +data+"<br/><a href='javascript:void(0);' file_name='"+data+"'>");
				$("#hidden_logo").val(data);

			}
		});
	}
	function upload(obj){
		$(obj).uploadify({
			'height'   : 140,
			'width'   : 140,
			'multi':true,
			'formData'      : {'file_type' : 0},
			'swf'      : '__APP_SKIN__js/uploadify/uploadify.swf',    //指定上传控件的主体文件
			'uploader' : '{:Controller::createUrl("vis/file/index")}',    //指定服务器端上传处理文件
			'fileTypeExts': '*.jpg',  //jpeg;*.gif;*.png
			'fileTypeDesc': 'Image Files',
			'fileSizeLimit' : '4096KB',
			'buttonText':"",
			'queueSizeLimit' : 5,
			//检测FLASH失败调用
			'onFallback':function(){
				alert("您的浏览器未安装FLASH控件，无法上传图片，请安装FLASH控件后再试！");
			},
			//返回一个错误，选择文件的时候触发
			'onSelectError':function(file, errorCode, errorMsg){
				switch(errorCode) {
					case -100:
						alert("上传的文件数量已经超出限制的"+$('a[name=file_upload]').uploadify('settings','queueSizeLimit')+"个文件！");
						break;
					case -110:
						alert("文件 ["+file.name+"] 大小超出系统限制的"+$('a[name=file_upload]').uploadify('settings','fileSizeLimit')+"大小！");
						break;
					case -120:
						alert("文件 ["+file.name+"] 大小异常！");
						break;
					case -130:
						alert("文件 ["+file.name+"] 类型不正确！");
						break;
				}
			},

			'onUploadError':function(file, errorCode, errorMsg, errorString){
				alert(errorString);
			},
			'onUploadSuccess' : function(file, data, response) {
				var service_url = "{:Controller::getConfig('file_server_url')}";
				var jsons       = "/2013/"+data;
				//$('#' + file.id).parent().find('img').remove();

				//$('#' + file.id).parent().attr('filename',data);
				if ($(".no_pic").length > 0) {
					$(".no_pic").remove();
				}
				$("<div style='float: left;margin-right:10px;text-align: center'><input type='hidden' name='upload_files' value='"+data+"' />" +
						"<img class='preview-upload-pic' style='height:110px;max-width:160px; margin:5px;' src='"+service_url+jsons+"'/>&nbsp;" +data+"<br/><a href='javascript:void(0);' file_name='"+data+"'class='del_pic'>删除</a><br/><br/><br/></div>").appendTo($('#s_attach'));
				bind_del_pic();
			}
		});
	}
	function bind_del_pic(){
		$(".del_pic").click(function(){
			$(this).parent().remove();
			$("#del_attch").append("<input type='hidden' name='deled_pic[]' value='"+$(this).attr('file_name')+"' />");
		});
	}
</script>
</body>
</html>
